package com.donleo.security.service.impl;

import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.donleo.common.model.Code;
import com.donleo.security.mapper.CodeMapper;
import com.donleo.security.service.CodeService;
import com.donleo.security.vo.CodeVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 码表 服务实现类
 * </p>
 *
 * @author liangd
 * @since 2020-12-21
 */
@Service
public class CodeServiceImpl extends ServiceImpl<CodeMapper, Code> implements CodeService {

    @Autowired
    private CodeMapper codeMapper;

    @Override
    public List<Code> findAll(CodeVo codeVo) {
        return codeMapper.findAll(codeVo);
    }

    @Override
    public long getCount(CodeVo codeVo) {
        return codeMapper.getCount(codeVo);
    }

    @Override
    public List<Code> findByType(String type) {
        return new LambdaQueryChainWrapper<>(codeMapper).eq(Code::getType, type).list();
    }
}
